1. Technical Field
The present invention relates to an improved method and system for data processing in general and, in particular, to an improved method and system for processing non-native instructions within a computer system. Still more particularly, the present invention relates to an improved method and system for executing a non-native stack-based instruction within a computer system.
2. Description of the Prior Art
The World Wide Web, or as it is simply known, the "Web," has dramatically changed the online world and continues to grow in popularity. As a communications system, the Web allows information providers to distribute and collect information globally and instantly. For users, the Web is a dynamic view into the works and ideas of millions of people worldwide. Through a system of hypertext, users of the Web are able to select and view information from all over the Web. While the hypertext system gives Web users a high degree of selectivity over the information they choose to view, their level of interactivity with that information is low. Even with improvements such as hypermedia, which opens up many new kinds of sensory input for the Web users, including access to graphics and videos, the Web itself still lacks a true interactivity, that is, a kind of real-time, dynamic, and visual interaction between Web users and applications.
Java.sup.1 brings this missing interactivity to the Web. With Java, animations and interactive applications on the Web become feasible. Java's features enrich communication, information, and interaction on the Web by enabling the distribution of executable content-rather than just Hypertext Markup Language (HTML) pages and hypermedia files-among Web users. This ability to distribute executable content is one of the powerful features of Java. FNT .sup.1 Java is a trademark of Sun Microsystems, and is also the name of a programming language developed by Sun Microsystems.
In order to view and interact with animations and the interactive applications on the Web, a Web user must have a computer installed with a Java-enabled Web browser. Even so, because Java has an instruction set that is different from the instruction set of most, if not all, processors utilized within a Web user's personal computer, Java instructions typically cannot be executed in their original bytecode form. Hence, some form of translation from the Java instruction set to an instruction set associated with the processor within the personal computer is required. Conventionally, an instruction set associated with a particular processor is called a "native" instruction set to that computer, while an instruction set that is not specifically developed for that particular processor is called a "non-native" instruction set to that particular computer. In this case, Java would be a non-native instruction set with respective to a typical Web user's computer.
In addition, Java is also a stack-based instruction set, which means the operands and results of calculations are taken from, and stored to, a stack memory. The stack memory is usually implemented as a segment within the main memory of the Web user's computer. Most Java instructions require access to the stack memory. These instructions either get operands from the stack memory, store results to the stack memory, or move data between the stack memory and a local variable memory (or local memory) that is also part of the main memory. Calculations performed in a stack memory are typically different from calculations performed by a processor that utilizes a fixed number of General Purpose Registers (GPRs) to hold the operands and the results of the calculations.
As an example, the Java ILOAD instruction loads a value from the local memory and "pushes" it onto the stack memory. In order to accomplish this, the processor could execute a local.sub.-- memory-to-GPR operation followed by a GPR-to-stack.sub.-- memory operation. This requires a minimum of two native instructions. As another example, the Java ISTORE instruction does the opposite; it "pops" a value off the stack memory and stores the value to the local memory. In order to accomplish this, the processor could execute a stack-to-GPR operation followed by a GPR-to-local.sub.-- memory operation. Again, this requires a minimum of two native instructions.
In most cases, pushing a value into the stack memory and then popping the same value off the stack memory without any other manipulation to the value is simply a natural result of the non-native code translation. Needless to say, these unnecessary redundant steps do not provide the most efficient native code for execution. Due to the large number of stack access instructions that are commonly encountered in a program written in Java, it is desirable to provide a more efficient method for executing these type of Java instructions within a computer system.